import { Logger } from "@/utils/logger";
import { register, reject } from "./api";

register('log', (operation, opts) => {
    if (operation === 'get') {
        return `当前 log 等级：${Logger.getLogLevel()}`;
    }
    else if (operation === 'set') {
        const [level] = opts;
        Logger.setLogLevel(~~level);
        return `已设置 log 等级：${~~level}`;
    }
    else {
        return reject();
    }
});